C undefined reference to `some_foo'

Posted by sterh on Stack Overflow See other posts from Stack Overflow or by sterh
Published on 2010-05-23T13:35:37Z Indexed on 2010/05/23 13:40 UTC
Read the original article Hit count: 168

Filed under:

Hello,

I have 3 files in my gtk+ app:

main.c:

#include <gtk/gtk.h>
#include <glib/gi18n.h>

#include "mainwindow.h"

int main(int argc, char** argv)
{
    MainWin*      win;
    GError* err = NULL;
    int a = 0;
    a = some_foo();
    gtk_main();
    return 0;
}

mainwindo.h

#include <gtk/gtk.h>


typedef struct _MainWin
{
    GtkWindow parent;

} MainWin;

GtkWidget* main_win_new();

int some_foo();

MainWindow.c

#include "mainwindow.h"


int some_foo()
{
  return 1;
}

When i try to call some_foo in main function, and try to compile i see error: undefined reference to `some_foo'. What's wrong?

Thank you.

© Stack Overflow or respective owner

Related posts about c